Socket
Socket
Sign inDemoInstall

@saberhq/tsconfig

Package Overview
Dependencies
Maintainers
2
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saberhq/tsconfig

Saber TypeScript configurations.


Version published
Maintainers
2
Created
Source

@saberhq/tsconfig

Saber TypeScript configurations.

Usage

The TSConfig adds the importHelpers, so first run:

yarn add tslib

Libraries

In your tsconfig.json, use the following:

{
  "extends": "@saberhq/tsconfig/tsconfig.lib.json",
  "include": ["src/", "tests/"]
}

Note that noEmit is enabled by default, for typechecking.

We recommend creating both a CommonJS and ESM build. The CommonJS build is useful for web apps, and the ESM build is useful for server-side apps and some web apps. For this, add the following two files:

tsconfig.esm.json
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "noEmit": false,
    "outDir": "dist/esm/"
  },
  "include": ["src/"]
}
tsconfig.cjs.json
{
  "extends": "./tsconfig.esm.json",
  "compilerOptions": {
    "module": "CommonJS",
    "outDir": "dist/cjs/"
  },
  "include": ["src/"]
}

Additionally, modify package.json with the following:

{
  // ...
  "main": "dist/cjs/index.js",
  "module": "dist/esm/index.js",
  "scripts": {
    // ...
    "build": "tsc -P tsconfig.cjs.json && tsc -P tsconfig.esm.json",
    "clean": "rm -fr dist/",
    "typecheck": "tsc"
  }
}

Keywords

FAQs

Package last updated on 30 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc